/*
 * @Author       : Hejh(3010733382@qq.com)
 * @Version      : V1.0
 * @Date         : 2024-01-30 11:01:15
 * @Description  : 题目相关接口
 */

import type {
  QuestionCreateReq,
  QuestionPageRes,
  QuestionReq,
  QuestionUpdateReq
} from '@/types/question'
import request from '@/utils/request'

// 分页查询题目接口
export const getQuestionByPage = (params?: QuestionReq) => {
  return request.get<QuestionPageRes>('/question/list', { params })
}

// 添加题目接口
export const createQuestion = (data: QuestionCreateReq) => {
  return request.post('/question/create', data)
}

// 更新题目接口
export const updateQuestion = (data: QuestionUpdateReq) => {
  return request.put('/question/update', data)
}

// 题目排序接口
export const sortQuestion = (questionIds: string[]) => {
  return request.put('/question/sort', { questionIds })
}

// 题目删除接口
export const delQuestion = (questionIds: string[], picCode?: string) => {
  return request.delete('/question/delete', { data: { questionIds, picCode } })
}
